/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.entities;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author hendrikdekock
 */
@Entity
@Table(name = "INVITEBYID")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Invitebyid.findAll", query = "SELECT i FROM Invitebyid i"),
    @NamedQuery(name = "Invitebyid.findBySenderid", query = "SELECT i FROM Invitebyid i WHERE i.invitebyidPK.senderid = :senderid"),
    @NamedQuery(name = "Invitebyid.findByInviteid", query = "SELECT i FROM Invitebyid i WHERE i.invitebyidPK.inviteid = :inviteid"),
    @NamedQuery(name = "Invitebyid.findByLeagueid", query = "SELECT i FROM Invitebyid i WHERE i.invitebyidPK.leagueid = :leagueid")})
public class Invitebyid implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected InvitebyidPK invitebyidPK;
    @JoinColumn(name = "LEAGUEID", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private League league;
    @JoinColumn(name = "SENDERID", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Account account;
    @JoinColumn(name = "INVITEID", referencedColumnName = "ID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Account account1;

    public Invitebyid() {
    }

    public Invitebyid(InvitebyidPK invitebyidPK) {
        this.invitebyidPK = invitebyidPK;
    }

    public Invitebyid(int senderid, int inviteid, int leagueid) {
        this.invitebyidPK = new InvitebyidPK(senderid, inviteid, leagueid);
    }

    public InvitebyidPK getInvitebyidPK() {
        return invitebyidPK;
    }

    public void setInvitebyidPK(InvitebyidPK invitebyidPK) {
        this.invitebyidPK = invitebyidPK;
    }

    public League getLeague() {
        return league;
    }

    public void setLeague(League league) {
        this.league = league;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    public Account getAccount1() {
        return account1;
    }

    public void setAccount1(Account account1) {
        this.account1 = account1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (invitebyidPK != null ? invitebyidPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Invitebyid)) {
            return false;
        }
        Invitebyid other = (Invitebyid) object;
        if ((this.invitebyidPK == null && other.invitebyidPK != null) || (this.invitebyidPK != null && !this.invitebyidPK.equals(other.invitebyidPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "boundless.entities.Invitebyid[ invitebyidPK=" + invitebyidPK + " ]";
    }
    
}
